
let lastTime = new Date().getTime();
let newTime = new Date().getTime();
let TimeOut = 1 * 60 * 1000

window.onload = function () {
    window.document.onmousedown = function () {
        let token = window.localStorage.getItem('token');
        lastTime = Number(window.localStorage.getItem('lastTime'));

        if(token && lastTime) {
            newTime = new Date().getTime();
            if(newTime - lastTime > TimeOut) {
                if(window.location.pathname == '/Login') return ;
                window.location.pathname = '/Login';
            }else{
                window.localStorage.setItem('lastTime',new Date().toString())
            }
        }else{
            if(token){
                window.localStorage.setItem('lastTime',new Date().toString())
            }else{
                if(window.location.pathname == '/Login') return ;
                window.location.pathname = '/Login';
            }
        }
    }
}
export {}